package com.android.zweibo.imgcache;

import com.android.zweibo.app.WeiboApplication;

import android.graphics.Bitmap;
import android.widget.ImageView;

public class SimpleImageLoder {
    
	/**
	 * 显示图片
	 * @param view
	 * @param url
	 */
	public static void showImage(ImageView view, String url) {
		view.setTag(url);
		view.setImageBitmap(WeiboApplication.imageLoader.get(url,getCallBack(url,view)));
	}

	
	/**
	 * 回调，加载图片
	 * @param url
	 * @param view
	 * @return
	 */
	private static ImageLoaderCallBack getCallBack(final String url, final ImageView view) {
        
		return new ImageLoaderCallBack() {

			@Override
			public void refesh(String url, Bitmap bitmap) {
				if(url.equals(view.getTag().toString())) {
					view.setImageBitmap(bitmap);
				}
			}
			
		};
	}

}
